public class Person implements Cloneable{

    public String name;
    public int age;
    Money m = new Money();

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", m=" + m +
                '}';
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Person() {
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person temp = (Person) super.clone();
        temp.m = (Money)this.m.clone();
        return temp;
    }

    public static void main(String[] args) throws CloneNotSupportedException{
        Person person1 = new Person("zhangsan", 32);
        Person person2 = (Person) person1.clone();
        System.out.println(person1.toString());
        System.out.println(person2.toString());

        person2.name = "lisi";
        person2.age = 51;
        person2.m.m =  73.3;

        System.out.println(person1.toString());
        System.out.println(person2.toString());
    }
}

class Money implements Cloneable{
    public double m = 56.2;

    @Override
    public String toString() {
        return m + "" ;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}